<template>
  <comNavigation>
    <template v-slot:title>
      选择科室
    </template>
  </comNavigation>
  <div>
    <div style="display: inline-block;">

      <van-sidebar v-model="active">
        <van-sidebar-item @click="setData(item.child)" v-for="item in list" :title="item.name" />
      </van-sidebar>
    </div>
    <div class="rigthBox">
      <p  @click="router.push('/describeIllness')" v-for="item in listChild">{{ item.name}}</p>
    </div >
  </div>
</template>

<script setup lang="ts">
import comNavigation from '@/components/common/com-navigationBar/com-navigation.vue';
import { ref, onMounted } from 'vue'
const active = ref(0);
import { getDepAAPI } from '@/api/home'
import { useRouter } from 'vue-router';
const router=useRouter()
const list = ref()
onMounted(async () => {
  const res = await getDepAAPI()
  list.value = res.data.data
  console.log(list.value);
  listChild.value=list.value[0].child
})
let listChild=ref([])

const setData =(val:any)=>{
  listChild.value=val
}
</script>
<style>
.rigthBox {
  width: 100px;
  display: inline-block;
  vertical-align: top;
  p{
    height: 50px;
  }
}
</style>
